#include "common.h"

#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     b2DistanceJoint
 * Method:    jniLocalAnchorA
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_b2DistanceJoint_jniLocalAnchorA
  (JNIEnv *env, jclass cls, jint addr)
{
	b2DistanceJoint* joint = (b2DistanceJoint*)addr;
	return (jint)(&(joint->GetLocalAnchorA()));
}

/*
 * Class:     b2DistanceJoint
 * Method:    jniLocalAnchorB
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_b2DistanceJoint_jniLocalAnchorB
  (JNIEnv *env, jclass cls, jint addr)
{
	b2DistanceJoint* joint = (b2DistanceJoint*)addr;
	return (jint)(&(joint->GetLocalAnchorB()));
}

/*
 * Class:     b2DistanceJoint
 * Method:    jniSetLength
 * Signature: (IF)V
 */
JNIEXPORT void JNICALL Java_b2DistanceJoint_jniSetLength
  (JNIEnv *env, jclass cls, jint addr, jfloat length)
{
	b2DistanceJoint* joint = (b2DistanceJoint*)addr;
	joint->SetLength(length);
}

/*
 * Class:     b2DistanceJoint
 * Method:    jniSetFrequency
 * Signature: (IF)V
 */
JNIEXPORT void JNICALL Java_b2DistanceJoint_jniSetFrequency
  (JNIEnv *env, jclass cls, jint addr, jfloat hz)
{
	b2DistanceJoint* joint = (b2DistanceJoint*)addr;
	joint->SetFrequency(hz);
}

/*
 * Class:     b2DistanceJoint
 * Method:    jniSetDampingRatio
 * Signature: (IF)V
 */
JNIEXPORT void JNICALL Java_b2DistanceJoint_jniSetDampingRatio
  (JNIEnv *env, jclass cls, jint addr, jfloat ratio)
{
	b2DistanceJoint* joint = (b2DistanceJoint*)addr;
	joint->SetDampingRatio(ratio);
}

/*
 * Class:     b2DistanceJoint
 * Method:    jniGetReactionForce
 * Signature: (IF)I
 */
JNIEXPORT jint JNICALL Java_b2DistanceJoint_jniGetReactionForce
  (JNIEnv *env, jclass cls, jint addr, jfloat)
{
	b2DistanceJoint* joint = (b2DistanceJoint*)addr;
	b2Vec2* vector = new b2Vec2();
	*vector = joint->GetReactionForce(inv_dt);
	return (jint)vector;
}

#ifdef __cplusplus
}
#endif
